<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>手机商城</title>
<!-- CSS -->
<link rel="stylesheet" href="{url:#css/materialize.min.css}" />
<link rel="stylesheet" href="{url:#css/me.css}" />
<link rel="stylesheet" href="{url:#css/iconfont.css}" />
<!-- JS -->
<script src="{url:#js/jquery-1.11.3.min.js}"></script>
<script src="{url:#js/materialize.min.js}"></script>
<script src="{url:#js/yang_check.js}"></script>


</head>
<body>
<!-- TitleBar 开始 -->
<div class="navbar-fixed custom-navbar">
  <nav>
    <div class="nav-wrapper red accent-4 valign-wrapper custom-navbar">
      <ul class="left" id="nav-btn-left" onclick="window.history.go(-1);">
        <li><a ><i class="iconfont">&#xe63c;</i></a></li>
      </ul>
      <span class="title-bar-size center_align">确认订单</span>
      <ul class="right">
        <li><a  class="disabled" style="visibility:hidden"><i class="iconfont">&#xe63c;</i></a></li>
      </ul>
    </div>
  </nav>
</div>
<!-- TitleBar 结束 -->

<!-- 收货地址 -->
<div id="addr-layout">
	<div class="row">
		<div class="col s1 addr-icon">
			<i class="iconfont" style="font-size:2em;">&#xe66c;</i>
		</div>
		<div class="col s10">
			{if:empty($addr_obj)}
				<div style="margin-top:10px; width:100%;">
					<span>&nbsp;</span>
					<span class="right">&nbsp;</span>
				</div>
				<p style="margin-top:5px;">
					收货地址为空
				</p>
			{else:}
				<div style="margin-top:10px; width:100%;">
					<span>{$addr_obj['accept_name']}</span>
					<span class="right">{$addr_obj['mobile']}</span>
				</div>
				<p style="margin-top:5px;">
					{echo:Zyk_tj::zyk_info('area',$addr_obj['province'],'name')}
					{echo:Zyk_tj::zyk_info('area',$addr_obj['city'],'name')}
					{echo:Zyk_tj::zyk_info('area',$addr_obj['county'],'name')}{$addr_obj['addr']}
				</p>
			{/if}
			
		</div>
		<div class="col s1 addr-icon" style="margin:0px; padding:0px;" onclick="document.location.href='{url:/mobile/my_addr/is_choose_addr/1}'">
			<i class="iconfont" style="font-size:2em; margin:0px; padding:0px;">&#xe63f;</i>
		</div>
	</div>
</div>
<!-- 结束 -->

<input type="hidden" name="addr_id" id="addr_id" value="{$addr_obj['id']|0}"/>
<input type="hidden" name="goods_list_str" id="goods_list_str" value='{$goods_list_str}'/>
<!-- 商品列表 -->
<div id="addr_list">
	<ul class="mgr-0 padd-0">
		{set:$order_total_money=0}
		{list:items=$sub_goods_list}
		{set:$order_total_money += $item['sell_price']*$item['buy_num']}
		<li>
			<div>
				<!-- 商品图片 -->
				<div class="left-align pro-img">
					<img src="{$item['img']}" width="95px" height="95px"/>
				</div>
				<!-- 商品详情 -->
				<div class="pro-info">
					<p>{$item['name']}</p>
					
					<span style="color:#FF0000; font-weight:500; font-size:1.1em;">￥{$item['sell_price']}</span>
					 <br>
					<span margin-left:5px;">数量: {$item['buy_num']}</span>&nbsp;&nbsp;&nbsp;
					<span style="font-size:0.85em;">{$item['spec']}</span>
				</div>
			</div>
		</li>
		<li class="divider" style="clear:both;">
		</li>
		{/list}
		<!-- 
		<li>
			<div>
				
				<div class="left-align pro-img">
					<img src="images/temp/classify_ten.png" width="95px" height="95px"/>
				</div>
				<
				<div class="pro-info">
					<p>自然乐园【赣南香橙】想不想吃，看着都馋了！！！精心包装5Kg....</p>
					<span style="color:#FF0000; font-weight:500; font-size:1.1em;">￥49.00</span>
					<span style="color:#FF0000; margin-left:10px;">积分:12</span>
					<br />
					<span style="font-size:0.85em;">数量x1 红色 XL</span>
				</div>
			</div>
		</li>
		-->
	</ul>
</div>
<!-- 列表结束 -->

<!-- 积分抵购 -->
<!-- 
<div class="row mgr-0 padd-0 addr-offset">
	<div class="col s10 offset-text">可用<span class="red-text">2</span>积分抵消<span class="red-text">￥0.02</span></div>
	<div class="col s2">
		<p>
		  <input type="checkbox" class="filled-in" id="check1"/>
		  <label for="check1"></label>
    	</p>
	</div>
</div>
-->
<div class="row white" style="margin-top:10px;">
  <div class="input-field col s12">
    <i class="material-icons prefix">mode_edit</i>
    <textarea id="leave_message" class="materialize-textarea" placeholder='买家留言'></textarea>
    <label for="user_center"></label>
  </div>
</div>

<!-- 确认结算 -->
<div class="buy-toolbar">
	<div class="divider"></div>
	<div class="row" style="height:49px;">
		<div class="col s8 bor addr-count-text">
			<!-- 共<span class="red-text">2</span>件，-->总金额<span class="red-text"> ￥{echo:sprintf(" %.2f", $order_total_money)}</span>
		</div>
		
		<div class="col s4 now-buy" onclick="sub_order(this)">
			提交订单
		</div>
	</div>
</div>	
<!-- 结束 -->
<script type="text/javascript">
function sub_order( obj )
{
	var addr_id = $("#addr_id").val();
	
	if(parseInt( addr_id ) == 0)
	{
		yang_alert('请选择收货地址');
		return;
	}
	
	var leave_message = $("#leave_message").val();//买家留言

	//$(obj).removeAttr('onclick');
	$(obj).attr("disabled", true);
	var goods_list = $("#goods_list_str").val();

	//alert( addr_id );
	//提交订单
	$.post("{url:/mobile/order_act}",{addr_id:addr_id,leave_message:leave_message,goods_list:goods_list},function(data){
		if(data['status']=='success')
	    {
			NativeBinder.nativeToast("{'msg':'"+data['msg']+"','ms':0}");
		    //yang_alert(data['msg']);
		    //个人中心页面
            document.location.href="{url:/mobile/user_center}";
        }
        else
	    {
        	NativeBinder.nativeToast("{'msg':'"+data['msg']+"','ms':0}");
        	$(obj).attr("disabled", false);
            //yang_alert(data['msg']);
            //document.location.href="{url:/mobile/my_addr}";
        }
    },'json');
    
	
	
}
</script>
</body>
</html>
